home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / SourceCode / TabCell / MyController.m < prev    next >
Text File  |  1994-08-04  |  1KB  |  56 lines

  1. #import "TabSelectionCell.h"
  2.  
  3. #import "MyController.h"
  4.  
  5. @implementation MyController
  6.  
  7. - appDidInit:sender
  8. {
  9.     NXRect    backgroundRect,matrixRect;
  10.  
  11.     /* Set backgroundView to be flipped ('cause Matrices are flipped) */
  12.     [backgroundView setFlipped:YES];
  13.     
  14.     /* Get the backgroundView's dimensions */
  15.     [backgroundView getBounds:&backgroundRect];
  16.  
  17.     /* Set up the matrix bounds */
  18.     matrixRect = backgroundRect;
  19.     matrixRect.origin.y = NX_MAXY(&matrixRect) - 17.0;
  20.  
  21.     /* Prepare a matrix to go inside the backgroundView */
  22.     tabMatrix = [[Matrix allocFromZone:[self zone]] initFrame:&matrixRect 
  23.                                 mode:NX_RADIOMODE
  24.                                 cellClass:[TabSelectionCell class]
  25.                                 numRows:1
  26.                                 numCols:4];
  27.     
  28.     /* Set the background gray of tabMatrix to NX_DKGRAY */
  29.     [tabMatrix setBackgroundGray:NX_DKGRAY];
  30.     
  31.     /* Set the autosizing and autoscrolling attributes of the matrix */
  32.     [tabMatrix setAutosizing:NX_WIDTHSIZABLE|NX_HEIGHTSIZABLE];
  33.     [tabMatrix setAutoscroll:YES];
  34.  
  35.     /* Stick the matrix in our scrollView */
  36.     [backgroundView addSubview:tabMatrix];
  37.  
  38.     /* Set our target and single-click actions */
  39.     [tabMatrix setTarget:self];
  40.     [tabMatrix setAction:@selector(tabMatrixAction:)];
  41.  
  42.     /* Size tabMatrix to its cells and display it */
  43.     [tabMatrix sizeToCells];
  44.     [tabMatrix display];
  45.  
  46.     return self;
  47. }
  48.  
  49. - tabMatrixAction:sender
  50. {
  51.     /* Put a cool action here (probably something like switching views
  52.         underneath the tabs) */
  53.     return self;
  54. }
  55.  
  56. @end